<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>定时器</title>
		<script>
			var timer1,timer2;
			var i=1;
			function funA(){
				var obj=document.getElementById("s1");
				obj.innerHTML=i++;
				timer1=setTimeout("funA()",1000);
			}
			window.onload=timeA();
			
			function timeA(){
				timer2=setInterval("timeB()",1000);  //setInterval():方法会不停地调用函数，直到 clearInterval() 被调用或窗口被关闭
			}
			
			function timeB(){
				document.getElementById("s1").innerHTML=i+++"秒";
			}
			</script>
	</head>
	<body>
		<span id="s1"></span>
	</body>
</html>
